<template>
	<view class="login-user-info">
		<block v-if="!isLogin">
			<view class="user-avatar">
				<image src="../../../../static/images/avatar.png" mode="aspectFill"></image>
				<view class="go-login" @click="goPage('/pages/entrance/login/login')">
					<text>去登录</text>
				</view>
			</view>
			<view class="user-setting">
				<text class="iconfont icon-message" :class="{'radius':redRdius}" @click="goPage('/pages/public/notice/notice')"></text>
				<text class="iconfont icon-setting" @click="goPage('/pages/users/settings/settimgs')"></text>
			</view>
		</block>
		<block v-else>
			<view class="user-avatar" @click="goPage('/pages/users/account/account')">
				<image :src="userInfo.avatar ?  userInfo.avatar : require('../../../../static/images/avatar.png')" mode="aspectFill"></image>
				<view class="user-name">
					<text>{{userInfo.username}}</text>
					<text>UID:{{userInfo.id}}</text>
				</view>
			</view>
			<view class="user-setting">
				<text class="iconfont icon-message" :class="{'radius':redRdius}" @click="goPage('/pages/public/notice/notice')"></text>
				<text class="iconfont icon-setting" @click="goPage('/pages/users/settings/settimgs')"></text>
			</view>
		</block>
	</view>
</template>

<script>
	import {mapState} from "vuex";
	export default{
		name:"LoginUserInfo",
		props:{
			redRdius:{
				type:Boolean,
				default:false
			}
		},
		computed:{
			...mapState(["isLogin","userInfo"]),
		},
		methods:{
			goPage(url){
				uni.navigateTo({
					url:url
				})
			},
		}
	}
</script>

<style scoped lang="less" src="./LoginUserInfo.less">
</style>
